﻿using System;
using System.Text;

namespace FrameWork
{
    partial class HexAndByte
    {
        public static byte[] Hex2Byte(string strhex)
        {
            strhex = strhex.Replace(" ", "");
            var buffer = new byte[strhex.Length / 2];
            for (var i = 0; i < strhex.Length; i += 2)
            {
                buffer[i / 2] = Convert.ToByte(strhex.Substring(i, 2), 16);
            }
            return buffer;
        }
    }
}
